/**
 * @param {string} s
 * @return {number}
*/
var maxDepth = function(s) {
  let left = 0, result = 0;
  for(let i = 0; i < s.length; i++) {
    if(s[i] == '(') left++;
    else if(s[i] == ')') left--;
    result = Math.max(result, left);
  }
  return result;
};
let s = "(1+(2*3)+((8)/4))+1";
console.log(maxDepth(s));
s = "(1)+((2))+(((3)))";
console.log(maxDepth(s));
s = "()";
console.log(maxDepth(s));
